<?php
////////////////////////////////////////////////////////////////////////////
//                                                                        //
// NOTICE OF COPYRIGHT                                                    //
//                                                                        //
// Dean`s Office for Moodle                                               //
// Электронный деканат                                                    //
// <http://deansoffice.ru/>                                               //
//                                                                        //
// Copyright (C) 2008-2999  Alex Djachenko (Алексей Дьяченко)             //
// alex-pub@my-site.ru                                                    //
// Copyright (C) 2008-2999  Evgenij Cigancov (Евгений Цыганцов)           //
// Copyright (C) 2008-2999  Ilia Smirnov (Илья Смирнов)                   //
// Copyright (C) 2008-2999  Mariya Rojayskaya (Мария Рожайская)           //
//                                                                        //
// This program is free software: you can redistribute it and/or modify   //
// it under the terms of the GNU General Public License as published by   //
// the Free Software Foundation, either version 3 of the Licensen.        //
//                                                                        //
// This program is distributed in the hope that it will be useful,        //
// but WITHOUT ANY WARRANTY; without even the implied warranty of         //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          //
// GNU General Public License for more details.                           //
//                                                                        //
// You should have received a copy of the GNU General Public License      //
// along with this program.  If not, see <http://www.gnu.org/licenses/>.  //
//                                                                        //
////////////////////////////////////////////////////////////////////////////
// Подключаем библиотеки
require_once('lib.php');

$DOF->modlib('nvg')->print_header(NVG_MODE_PORTAL);

$obj = new object();
$obj->programmid = 1;
$obj->agenum = 1;
$obj->courseclsid = 1;
$obj->name = 'test'.time();
$obj->code = 'test'.time();
$obj->type = 'required';
$obj->required = 1;
$obj->instrlevelid = 3;
$obj->gradelevel = 'discipline';
$obj->status = 'active';
$obj->departmentid = 1;
$obj->controltypeid = 0;
$obj->scale = '1,2,3,4,5,6-12,gsom,пыщь';
$obj->mingrade = 'пыщь';


$obj->mdlcourse = '';
$obj->sname = '';
$obj->scode = '';
$obj->about = '';
$obj->notice = '';
$obj->maxcredit = '';
$obj->maxduration = '';
$obj->hours = '';
$obj->hourstheory = '';
$obj->hourspractice = '';
$obj->eduweeks = '';

// записываем в базу и запомним id
$testid = $DOF->storage('programmitems')->insert($obj);
// проверяем положительность оценки
//var_dump($DOF->storage('programmitems')->is_positive_grade($testid, 'gsom'));

// проверяем выставление статуса "удалено"
//print_object($DOF->storage('programmitems')->get($testid));
//var_dump($DOF->storage('programmitems')->set_status_deleted($testid));
//print_object($DOF->storage('programmitems')->get($testid));

// удаляем запись из базы
$DOF->storage('programmitems')->delete($testid);

$DOF->modlib('nvg')->print_footer(NVG_MODE_PORTAL);
?>